import React from "react";
import ReactDom from "react-dom";
import "./index.css";
class App extends React.Component {
  constructor() {
    super();
    this.state = {
      door: "open",
    };
    this.handleClick = this.handleClick.bind(this);
  }
  handleClick() {
    console.log("click", this);
    this.setState({
      door: "close",
    });
  }
  render() {
    const { door } = this.state;
    return <h1 onClick={this.handleClick}>{door} 事件绑定</h1>;
  }
}

ReactDom.render(<App />, document.getElementById("root"));
